<?php

declare(strict_types=1);

namespace App\Model;


/**
 * @property int $id
 * @property string $nickname
 * @property string $nickname_new
 * @property int $nickname_suggestion
 * @property int $nickname_new_status
 * @property string $password
 * @property string $head_image
 * @property string $head_image_new
 * @property int $head_image_suggestion
 * @property int $head_image_status
 * @property string $signature
 * @property string $phone
 * @property int $sex
 * @property int $age
 * @property string $session_id
 * @property int $login_time
 * @property string $last_login_ip
 * @property string $register_ip
 * @property int $register_time
 * @property int $register_time_new
 * @property int $is_audit
 * @property int $in_audit
 * @property int $audit_white
 * @property string $imei
 * @property string $imei_login
 * @property string $oaid
 * @property int $is_binding
 * @property int $isdel
 * @property int $status
 * @property int $lock_time
 * @property int $unlock_time
 * @property int $vip
 * @property int $height
 * @property int $weight
 * @property string $weixin
 * @property string $qq
 * @property int $income
 * @property int $marry
 * @property string $province
 * @property string $city
 * @property int $user_type
 * @property string $version_code
 * @property string $ext
 * @property string $channel
 * @property int $qq_show
 * @property int $phone_show
 * @property int $weixin_show
 * @property int $online
 * @property int $auto_chat_online
 * @property int $vip_buy_type
 * @property int $gift_count
 * @property int $chat_count
 * @property int $sys_send_count
 * @property int $recharge_send_count
 * @property string $tmp_head_image
 * @property int $from
 * @property string $lock_remark
 * @property int $chat_key
 * @property string $ext2
 * @property int $integral
 * @property int $level
 * @property int $head_image_time
 * @property int $head_image_already_audited
 * @property string $weixinId
 * @property int $is_robot
 * @property string $origin_province
 * @property string $origin_city
 * @property int $isNewUser
 * @property string $lng
 * @property string $lat
 * @property int $is_disturb
 * @property int $noble
 * @property int $inviteUid
 * @property int $old_inviteUid
 * @property string $package
 * @property int $register_call_force_vip
 * @property int $get_free_video
 * @property int $already_buy_gold
 * @property int $paying_user
 * @property string $evaluate
 * @property string $want_evaluate
 * @property string $appleId
 * @property string $facebookId
 * @property string $googleId
 * @property string $facebook
 * @property string $twitter
 * @property int $guard
 * @property int $super_noble
 * @property string $wx_openid
 * @property string $wx_unionid
 * @property string $integrate_usable_count
 * @property string $integrate_freeze_count
 * @property string $freeze_remark
 * @property string $freeze_operator
 * @property int $freeze_time
 * @property int $is_cardAuth
 * @property int $is_faceAuth
 * @property int $is_newuser_welfare
 * @property string $token
 * @property int $isNewAudit
 * @property string $update_time
 * @property int $send_time
 * @property int $click_time
 * @property string $guild_num
 * @property string $agent_num
 * @property int $accept_video
 * @property int $accept_audio
 * @property int $not_show
 * @property string $phone_makers
 * @property int $login_env
 * @property int $first_in_app_time
 * @property int $show_gift
 * @property int $show_wealth
 * @property int $show_online
 * @property int $special_tag
 * @property int $wealth
 * @property string $recharge
 * @property int $push_level
 * @property int $push_level_time
 * @property int $in_app
 * @property int $hide_call_status
 */
class User extends Model
{
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'tb_user';

    /**
     * The attributes that are mass assignable.
     */
    // protected array $fillable = ['*'];
    protected array $guarded = [];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'nickname_suggestion' => 'integer', 'nickname_new_status' => 'integer', 'head_image_suggestion' => 'integer', 'head_image_status' => 'integer', 'sex' => 'integer', 'age' => 'integer', 'login_time' => 'integer', 'register_time' => 'integer', 'register_time_new' => 'integer', 'is_audit' => 'integer', 'in_audit' => 'integer', 'audit_white' => 'integer', 'is_binding' => 'integer', 'isdel' => 'integer', 'status' => 'integer', 'lock_time' => 'integer', 'unlock_time' => 'integer', 'vip' => 'integer', 'height' => 'integer', 'weight' => 'integer', 'income' => 'integer', 'marry' => 'integer', 'user_type' => 'integer', 'qq_show' => 'integer', 'phone_show' => 'integer', 'weixin_show' => 'integer', 'online' => 'integer', 'auto_chat_online' => 'integer', 'vip_buy_type' => 'integer', 'gift_count' => 'integer', 'chat_count' => 'integer', 'sys_send_count' => 'integer', 'recharge_send_count' => 'integer', 'from' => 'integer', 'chat_key' => 'integer', 'integral' => 'integer', 'level' => 'integer', 'head_image_time' => 'integer', 'head_image_already_audited' => 'integer', 'is_robot' => 'integer', 'isNewUser' => 'integer', 'is_disturb' => 'integer', 'noble' => 'integer', 'inviteUid' => 'integer', 'old_inviteUid' => 'integer', 'register_call_force_vip' => 'integer', 'get_free_video' => 'integer', 'already_buy_gold' => 'integer', 'paying_user' => 'integer', 'guard' => 'integer', 'super_noble' => 'integer', 'freeze_time' => 'integer', 'is_cardAuth' => 'integer', 'is_faceAuth' => 'integer', 'is_newuser_welfare' => 'integer', 'isNewAudit' => 'integer', 'send_time' => 'integer', 'click_time' => 'integer', 'accept_video' => 'integer', 'accept_audio' => 'integer', 'not_show' => 'integer', 'login_env' => 'integer', 'first_in_app_time' => 'integer', 'show_gift' => 'integer', 'show_wealth' => 'integer', 'show_online' => 'integer', 'special_tag' => 'integer', 'wealth' => 'integer', 'push_level' => 'integer', 'push_level_time' => 'integer', 'in_app' => 'integer', 'hide_call_status' => 'integer'];

    public static function findUserInfoById($uid)
    {
        return modelToArray(self::query()->find($uid));
    }

    /**
     * Note - 检测手机号
     * DateTime 2024/8/15 14:04
     * User Admin
     * @param $phone
     * @return bool
     */
    public static function checkPhone($phone)
    {
        return self::query()->where('phone', $phone)->where('isdel', 0)->where('is_binding', 1)->exists();
    }

}
